<template>
	<view>
		<u-card border-radius='0'
		:show-head="false" :show-foot="false" 
		margin="20rpx" padding='0' :border="false">
			<view slot="body">
				<view style="font-size: 36rpx; margin-top: 40rpx;margin-bottom: 20rpx;" :style="{'display': mostPeopleData.isShowPlateName ? 'block' : 'none'}">
					<view>{{mostPeopleData.plateName}}</view>
				</view>
				<view style="margin-top: 10rpx">
					<u-row style="width: 100%;">
						<u-col v-for="(item,index) in mostPeopleData.list" :key="index" span="6" @click="gotoDetail(item.houseId,item.type)">
							<view>
								<image :src="item.picPath" style="width: 100%;height: 250rpx"></image>
							</view>
							<view style="margin-bottom: 20rpx; width: 100%; text-align: center;">{{item.title}}
							</view>
						</u-col>
					</u-row>
				</view>
			</view>
		</u-card>
	</view>
</template>

<script>
	import config from "../../../utils/config.js"
	export default {
		data() {
			return {
				
			}
		},
		methods: {
			gotoDetail(houseId,type) {
				//跳转到租房或者卖房详情页
				if(type === 0){
					wx.navigateTo({
						// url: 'test?id=1&name=uapp'  c传递参数
						url: '/pages/components/rentDetail?houseId=' + houseId + '&recommandId=' + this.dataList.recommandId
					})
				}else{
					wx.navigateTo({
						// url: 'test?id=1&name=uapp'  c传递参数
						url: '/pages/components/buyDetail?houseId=' + houseId + '&recommandId=' + this.dataList.recommandId
					})
				}
			}
		},
		computed: {
			mostPeopleData() {
				// console.log(this.dataList)
				var list = []
				var houseInfo = this.dataList.houseInfo
				//获取图片的路径
				for (let i = 0; i < houseInfo.list.length; i++){
					let picPath = ''
					// let imageAddressList = houseInfo.list[i].imageAddressList
					// picPath = config.host + imageAddressList[0].address
					let house = []
					house = houseInfo.list[i].house
					if(house.indexImage !== ''&&house.indexImage !== null){
						picPath = config.host + house.indexImage
					}
					let title = house.title
					let data = {
						"houseId": house.id,
						"picPath": picPath,
						"title": title,
						"type": house.type,
						"price": house.price
					}
					list.push(data)
				}
				var show = {
					"plateName": this.dataList.plateName,
					"isShowPlateName": this.dataList.isShowPlateName,
					"list": list
				}
				return show
			}
		},
		props: {
			dataList: {}
		}
	}
</script>

<style scoped>
	.most-person-box {
		margin-top: 20rpx;
		height: 220rpx;
	}
</style>
